//
//  AIFSetRoleInfoManager.m
//  PywSdk
//
//  Created by Ampaw on 2017/7/11.
//  Copyright © 2017年 Jade. All rights reserved.
//

#import "AIFSetRoleInfoManager.h"
#import "PywSdk+login.h"
#import "NSString+URLEncode.h"

@implementation AIFSetRoleInfoManager


NSString *const RoleInfo_Account = @"account";
NSString *const RoleInfo_GameId = @"game_id";
NSString *const RoleInfo_Tid = @"tid";


- (instancetype)init
{
    self = [super init];
    if (self) {
        self.child = self;
        self.paramSource = self;
        self.validate = self;
    }
    return self;
}


#pragma mark - ETAPIManager
- (NSString *)methodName{
    return URL_SETROLEINFO;
}

- (ETAPIManagerRequestType)requestType{
    return ETAPIManagerRequestTypePost;
}


- (NSString *)seriviceType{
    return [PywAppInfo sharedAppInfo].seriviceType;
}


#pragma mark - ETAPIManagerParamSourceDelegate
- (NSDictionary *)paramsForApi:(ETApiBaseManager *)manager{
    
    NSString *gameid = [PywAppInfo sharedAppInfo].gameId;
    NSString *account = [PywPlatformMain sharedPlatformMain].account;
    NSString *tid = [PywAppInfo sharedAppInfo].tid;
    
    NSString *roleid = [[self.roleInfo objectForKey:key_Roleid] URLEncode];
    NSString *roleName = [[self.roleInfo objectForKey:key_RoleName] URLEncode];
    NSString *roleLevel = [[self.roleInfo objectForKey:key_RoleLevel] URLEncode];
    NSString *serverArea = [[self.roleInfo objectForKey:key_ServerArea] URLEncode];
    NSString *serverAreaName = [[self.roleInfo objectForKey:key_ServerAreaName] URLEncode];
    
    MutableDictionary *param = [[MutableDictionary alloc] init];
    [param setObject:account forKey:RoleInfo_Account];
    [param setObject:gameid forKey:RoleInfo_GameId];
    [param setObject:tid forKey:RoleInfo_Tid];
    
    [param setObject:roleid forKey:key_Roleid];
    [param setObject:roleName forKey:key_RoleName];
    [param setObject:roleLevel forKey:key_RoleLevel];
    [param setObject:serverArea forKey:key_ServerArea];
    [param setObject:serverAreaName forKey:key_ServerAreaName];
    return param;
}

#pragma mark - ETAPIManagerValidator
- (BOOL)manager:(ETApiBaseManager *)manager isCorrectWithParamsData:(NSDictionary *)data{
    return YES;
}

- (BOOL)manager:(ETApiBaseManager *)manager isCorrectWithCallBackData:(NSDictionary *)data{
    return YES;
}

@end
